package com.duanjw.springboot.echarts;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.event.GenericApplicationListener;
import org.springframework.core.ResolvableType;
import org.springframework.stereotype.Component;

/**
 * 自定义事件监听
 *
 * 放到容器两种方式
 * 1. 加注解
 * 2. META-INF/spring.factories 添加 org.springframework.context.ApplicationListener=\
 * #com.duanjw.springboot.echarts.MyListener
 */
@Component
public class MyListener implements GenericApplicationListener {
    @Override
    public boolean supportsEventType(ResolvableType eventType) {
        return true;
    }

    @Override
    public void onApplicationEvent(ApplicationEvent event) {
        System.out.println("进入到了我自定义的事件");
    }
}
